package com.sofwin.controller;/**
 * @PackageName:com.sofwin.controller
 * @author:andyLiu
 * @DateTime:2020/12/23 11:41
 * @Description:[TODO]输入当前模块作用
 **/

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName: TestController
 * @Description: TODO
 * @Author: andyliu
 * @Date: 2020/12/23 11:41
 * @Version: 1.0
 **/
@Controller
public class TestController {
    @GetMapping("/test")
    @ResponseBody
    public Map test(){
        Map map = new HashMap<String,String>();
        map.put("name","admin");
        return map;
    }
    @GetMapping("/test2")
    public String test2(Model model){
        model.addAttribute("userName","admin");
        return "/index.jsp";
    }
}
